#!/usr/bin/env python
# encoding: utf-8
# @author: qiaowei
# @license: (C) Copyright 2013-2019
# @contact: weiweiqiao@126.com
# @file: worker_01.py
# @time: 2020/8/1 0001
# @desc:


from PySide2.QtCore import QObject
from PySide2.QtCore import QThread


class WorkerFromQThread(QThread):
    """
    继承QThread，重写run方法测试多线程
    """
    def __init__(self, parent=None):
        super().__init__(parent)
        self.__content = ''

    def run(self):
        """
        打印当前线程id

        """
        print(self.__content + str(id(QThread.currentThread())))

    @property
    def content(self):
        """
        将方法包装成属性

        """
        return self.__content

    @content.setter
    def content(self, value: str):
        self.__content = value
